﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;

namespace SMS.Common.Search
{
    /// <summary>
    /// Lambda表达式搜索条件，本地使用，不可用于远程调用参数。
    /// </summary>
    public class LambdaSearchCondition<TEntity> : ExpressSearchCondition
    {
        private object m_Expression;
        public LambdaSearchCondition(Expression<Func<TEntity, bool>> expression)
        {
            m_Expression = expression;
        }
        public override Expression<Func<T, bool>> GetExpress<T>()
        {
            if (!(m_Expression is Expression<Func<T, bool>>)) throw new ArgumentException("表达式类型不正确，应为" + typeof(Expression<Func<T, bool>>).FullName);
            return m_Expression as Expression<Func<T, bool>>;
        }
    }
}
